package factory.simple_factory;

// 咖啡店
public class CoffeStore {

    public Coffee orderCoffee(String type){
//        Coffee coffee = null;
//        if("a".equals(type)){
//            coffee = new AmeriacanCoffee();
//        }else if("l".equals(type)){
//            coffee = new LetteCoffe();
//        }else{
//            throw new RuntimeException("没有这种类型的咖啡");
//        }

        // 根据工厂获取对应的咖啡对象
        Coffee coffee = CoffeeFactory.createCoffee(type);

        coffee.addSugar();
        coffee.addMilk();

        return coffee;
    }
}
